﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;

namespace OBUCare.Core.Models.Mapping
{
    public class SUPPLIERMap : EntityTypeConfiguration<SUPPLIER>
    {
        public SUPPLIERMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.NAME)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.SHORTNAME)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.ADDRESS)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.REMARK)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("SUPPLIERS");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.NAME).HasColumnName("NAME");
            this.Property(t => t.SHORTNAME).HasColumnName("SHORTNAME");
            this.Property(t => t.ADDRESS).HasColumnName("ADDRESS");
            this.Property(t => t.CAPITAL).HasColumnName("CAPITAL");
            this.Property(t => t.REMARK).HasColumnName("REMARK");
            this.Property(t => t.SUPPLIER_TYPE).HasColumnName("SUPPLIER_TYPE");
        }
    }
}
